package com.singularity.common.controller;

import cn.dev33.satoken.util.SaResult;

import com.singularity.common.domain.dto.user.UserListDTO;
import com.singularity.common.domain.param.user.UserListParam;
import com.singularity.common.service.UserService;
import com.singularity.utils.page.ResponseDTOWithPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 天
 *
 * @description: 用户相关控制层
 */
@Api(tags = "用户相关")
@RestController
@RequestMapping("/user")
public class UserController {

    private final UserService userService;

    @Autowired
    public UserController(UserService userService) {
        this.userService = userService;
    }

    @ApiOperation("获取用户列表")
    @RequestMapping(method = RequestMethod.POST,value = "/list")
    public SaResult getUserList(@RequestBody UserListParam userListParam){
        ResponseDTOWithPage<UserListDTO> list = userService.getUserList(userListParam);
        return new SaResult(SaResult.CODE_SUCCESS,"查询成功",list);
    }

}
